home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT8 / FVIDEO.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-05-10  |  2.9 KB  |  85 lines

  1. ;**********************************************************************
  2. ;
  3. ;  Program FVideo ( Chapter 8 )
  4. ;
  5. ;  The PC screen interfacing system.                             
  6. ;
  7. ;  Author: A.I.SOPIN,    Voronezh
  8. ;
  9. ;  Usage: Call  FVIDEO (TYPE)
  10. ;
  11. ;  This procedure can be called from programs in Pascal, FORTRAN or BASIC
  12. ;
  13. ;  TYPE  - the type of video adapter (Integer *1, Integer *2) returned
  14. ;
  15. ;  TYPE =0 -MDA
  16. ;  TYPE =1 -CGA
  17. ;  TYPE =2 -MCGA
  18. ;  TYPE =3 -EGA
  19. ;  TYPE =4 -VGA
  20. ;
  21. ;  All parameters are passed by reference, through the stack
  22. ;
  23. ;  All address of parameters contains both segment and offset
  24. ;
  25. ;**********************************************************************
  26. ;
  27. CODE    SEGMENT
  28. FVIDEO  PROC    FAR
  29.     PUBLIC  FVIDEO
  30.     ASSUME  CS:CODE
  31.     push    bp
  32.     mov     bp,sp
  33.     push    ax
  34.     push    bx
  35.     push    cx
  36.     push    dx
  37. ;----------------------------------------------------------
  38. ;  determining the type of video adapter used
  39. CHKVGA: mov     ax, 1A00h               ;  Request video info for VGA
  40.     int     10h                     ;  Get Display Combination Code
  41.     cmp     al, 1Ah                 ;  Is VGA or MCGA present?
  42.     jne     CHKEGA                  ;  No?  Then check for EGA
  43.     cmp     bl, 2                   ;  If VGA exists as secondary adapter,
  44.     je      CGA                     ;  check for CGA and mono as primary
  45.     jb      MONO
  46.     cmp     bl, 5                   ;  If EGA is primary, do normal
  47.     jbe     CHKEGA                  ;  EGA checking
  48. ;
  49. CHKMCGA:mov     al,2                    ;  Yes? Assume MCGA
  50.     cmp     bl, 8                   ;  Correct assumption?
  51.     ja      EXIT                    ;  pass type
  52. VGA:    mov     al,4                    ;  Assume it's VGA color
  53.     jmp     short EXIT              ;  pass type
  54. ;
  55. CHKEGA: mov     ah, 12h                 ;  Call EGA status function
  56.     mov     bl, 10h
  57.     sub     cx, cx                  ;  Clear status bits
  58.     int     10h                     ;  Get Configuration Information
  59.     jcxz    CHKCGA                  ;  If CX is unchanged, not EGA
  60. EGA:    mov     al,3                    ;  Set structure fields for EGA
  61.     jmp     short EXIT              ;  pass type
  62. ;
  63. CHKCGA: xor     ax,ax                   ;
  64.     mov     es,ax                   ;  BIOS  segment
  65.     mov     ax,es:[410h]            ;  0:410 -equipment list
  66.     and     al, 30h                 ;  If bits 4-5 set, monochrome
  67.     cmp     al, 30h                 ;  Monochrome text mode?
  68.     je      MONO                    ;  Yes? Continue
  69. CGA:    mov     al,1                    ;  No?  Must be CGA
  70.     jmp     short EXIT              ;  pass type
  71. MONO:   mov     al,0                    ;  Set MONO
  72. EXIT:   LDS     bx,[bp+6]               ;  address of parameter TYPE
  73.     mov     [bx],al                 ;  pass type
  74. ;----------------------------------------------------------
  75. ;  Restore registers and exit
  76. Popr:   pop     dx
  77.     pop     cx
  78.     pop     bx
  79.     pop     ax
  80.     pop     bp
  81.     RETF    4
  82. FVIDEO  ENDP
  83. CODE    ENDS
  84.     END
  85.